package com.kgc.onlineLife.service.impl;

import com.kgc.onlineLife.bean.OrderItem;
import com.kgc.onlineLife.mapper.OrderItemMapper;
import com.kgc.onlineLife.service.OrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created On : 2022/4/17.
 * <p>
 * Author     : 98730
 * <p>
 * Description: OrderItemServiceImpl
 */
@Service
public class OrderItemServiceImpl implements OrderItemService {

    @Autowired
    OrderItemMapper orderItemMapper;

    @Override
    public List<OrderItem> listByCustomer(int cstid) {
        return orderItemMapper.selectByCustomerId(cstid);
    }

    @Override
    public void update(OrderItem orderItem) {
        orderItemMapper.updateById(orderItem);
    }

    @Override
    public boolean insert(OrderItem orderItem) {
        return orderItemMapper.insertCart(orderItem) > 0 ;
    }

    @Override
    public boolean delete(int oiid) {
        return orderItemMapper.deletCartById(oiid) > 0;
    }

    @Override
    public OrderItem listById(int id) {
        return orderItemMapper.selectById(id);
    }

    @Override
    public boolean modOrderitemOid(Integer id, Integer oid) {
        return orderItemMapper.updateOrderitemOid(id, oid) > 0;
    }

    @Override
    public List<OrderItem> listByOid(int i) {
        return orderItemMapper.selectByOid(i);
    }
}
